package io.renren.modules.live.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.live.entity.FanweAnchorTokenEntity;
import io.renren.modules.live.service.FanweAnchorTokenService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-11-17 13:06:07
 */
@Api(tags = "后台主播Token管理")
@RestController
@RequestMapping("live/fanweanchortoken")
public class FanweAnchorTokenController {
    @Autowired
    private FanweAnchorTokenService fanweAnchorTokenService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("live:fanweanchortoken:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = fanweAnchorTokenService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    //@RequiresPermissions("live:fanweanchortoken:info")
    public R info(@ApiParam("anchorId") Long anchorId){
		FanweAnchorTokenEntity fanweAnchorToken = fanweAnchorTokenService.getById(anchorId);

        return R.ok().put("fanweAnchorToken", fanweAnchorToken);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("live:fanweanchortoken:save")
    public R save(@RequestBody FanweAnchorTokenEntity fanweAnchorToken){
		fanweAnchorTokenService.save(fanweAnchorToken);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("live:fanweanchortoken:update")
    public R update(@RequestBody FanweAnchorTokenEntity fanweAnchorToken){
		fanweAnchorTokenService.updateById(fanweAnchorToken);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("live:fanweanchortoken:delete")
    public R delete(@RequestBody Long[] anchorIds){
		fanweAnchorTokenService.removeByIds(Arrays.asList(anchorIds));

        return R.ok();
    }

}
